package com.jie.boot;

import java.io.IOException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import spring.data.jpa.config.EnableSimpleJpaRepositories;
import spring.data.jpa.freemarker.FreemarkerResourceContext;
import spring.data.jpa.repository.factory.SimpleJpaRepositoryFactoryBean;

/**
 *
 * @author wangjie
 * @version 1.0.0
 *
 */
@SpringBootApplication
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(repositoryFactoryBeanClass = SimpleJpaRepositoryFactoryBean.class, basePackages = { "com.jie.boot.repository" })
@EnableSimpleJpaRepositories(repositoryFactoryBeanClass = SimpleJpaRepositoryFactoryBean.class, basePackages = { "com.jie.boot.domain" })
public class SimpleApplication {

    public static void main(String[] args) {
        SpringApplication.run(SimpleApplication.class, args);
    }

    @Bean
    public FreemarkerResourceContext getContext() throws IOException {
        return new FreemarkerResourceContext("classpath:ftl.properties");
    }
}
